﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VRacer.Packets
{
    public class PlayerLapsPacket : PlayerPacket
    {
        private int _laps;

        public PlayerLapsPacket()
            : base(PacketType.PlayerLaps)
        {
            this.Length += 4;
        }

        public PlayerLapsPacket(PlayerBase player)
            : base(PacketType.PlayerLaps, player)
        {
            _laps = player.Laps;
        }

        public int Laps
        {
            get { return _laps; }
            set { _laps = value; }
        }

        public override void Read(System.IO.BinaryReader reader)
        {
            base.Read(reader);

            _id = reader.ReadInt32();
            _laps = reader.ReadInt32();
        }

        public override void Write(System.IO.BinaryWriter writer)
        {
            base.Write(writer);

            writer.Write(_id);
            writer.Write(_laps);
        }
    }
}
